/*
package com.jymj.controller;

import com.jymj.entity.MovecostEntity;
import com.jymj.entity.SysUserEntity;
import com.jymj.entity.YlEntity;
import com.jymj.entity.gantt.BaseDataEntity;
import com.jymj.entity.gantt.MoveCost;
import com.jymj.service.MoveCostService;
import com.jymj.service.YlService;
import com.jymj.utils.R;
import com.jymj.utils.ShiroUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static java.math.BigDecimal.ROUND_HALF_DOWN;

@RestController
@RequestMapping("/moveCost")
public class MoveCostController extends AbstractController {

    private final Logger LOGGER = LoggerFactory.getLogger(MoveCostController.class);
    @Autowired
    private MoveCostService moveCostService;

    @Autowired
    private YlService ylService;

    @RequestMapping("/queryList")
    public R queryList(String code){
        List<MovecostEntity> moveCostList = moveCostService.queryList1(code);
        return R.ok().put("data",moveCostList);
    }

    */
/**
     * 获取基本数据 总表 pjid 有值 point=“” 单户 pjid 有值 point=有值
     *
     * @param pjid
     * @param point
     * @return
     *//*

    @RequestMapping("/base")
    @ResponseBody
    public R baseData(@RequestParam("pjid") Integer pjid, @RequestParam("point") String point) {
        BaseDataEntity baseDataEntity = new BaseDataEntity();
        if (pjid != null && (point == null || point.equals(""))) {
            baseDataEntity = this.queryBaseData(pjid, null);
            return R.ok().put("data", baseDataEntity);
        }
        if (point != null && !point.equals("")) {
            //baseDataEntity = this.queryBaseData(null, point);
            YlEntity ylEntity = ylService.queryByPoint(point, pjid);
            Map map = new HashMap();
            map.put("baseDataEntity", baseDataEntity);
            map.put("ylEntity", ylEntity);
            return R.ok().put("data", map);
        }
        return R.ok().put("data", baseDataEntity);
    }

    //pjid  取基础数据
    private BaseDataEntity queryBaseData(Integer pjid, String point) {
        BaseDataEntity baseDataEntity = new BaseDataEntity();
        SysUserEntity user = ShiroUtils.getUserEntity();
        if (point != null) {
            baseDataEntity = moveCostService.queryByPoint(point, user.getCodeList(), pjid);
            return baseDataEntity;
        }
        if (pjid != null) {
            //List<String> codeList = sysProjXzqService.quetyCodeByPjid(pjid);

            */
/*  Object[] p = codeList.toArray();
                String[] strs = new String[p.length];
                for (int i = 0; i < p.length; i++) {
                    strs[i] = p[i].toString();
                }*//*

            try {
                baseDataEntity = moveCostService.getBaseDataById(pjid);
            } catch (Exception e) {
                LOGGER.error(e.getMessage(), e);

            }
        }
        return baseDataEntity;
    }

    */
/**
     * 获取拆腾测算表 拆腾 pjid 有值 point=“” 单户 pjid 有值 point=有值
     *
     * @param pjid
     * @param point
     * @return R
     * @throws Exception
     *//*

    @RequestMapping("/movecost")
    @ResponseBody
    public R movecost(@RequestParam("pjid") Integer pjid, @RequestParam("point") String point) throws Exception {
        BaseDataEntity baseDataEntity;
        List<MoveCost> mCList;
        List<MoveCost> moveCosts = new ArrayList<>();
        if (pjid != null && (point == null || point.equals(""))) {
            baseDataEntity = this.queryBaseData(pjid, null);
            mCList = moveCostService.queryList(pjid, 3);
            mCList = this.getMCList2(mCList, baseDataEntity);
            moveCosts = this.getTreeOrgs(mCList);
        }
        if (pjid != null && point != null && !point.equals("")) {
            YlEntity ylEntity = ylService.queryByPoint(point, pjid);
            //baseDataEntity = this.queryBaseData(null, point);
            mCList = moveCostService.queryList(pjid, 2);
            mCList = this.getMCList1(mCList, ylEntity);
            moveCosts = this.getTreeOrgs(mCList);
        }

        //Collections.sort(mCList);
        return R.ok().put("data", moveCosts);
    }

    */
/*
    * 获取测算总表
    * *//*

    @RequestMapping("/zbMovecost")
    @ResponseBody
    public R zbMovecost(@RequestParam("pjid") Integer pjid) throws Exception {
        List<MoveCost> mCList = moveCostService.queryList(pjid, 1);
        List<MoveCost> moveCosts;
        BaseDataEntity baseDataEntity = this.queryBaseData(pjid, null);
        //比较数据是否一致  一致返回   不一致重新查询修改
        if (mCList == null || mCList.get(25).getQuantitie() == null || mCList.get(26).getQuantitie() == null
                || mCList.get(27).getQuantitie() == null || mCList.get(10).getQuantitie() == null) {
            mCList = this.getMCList(mCList, baseDataEntity);
            moveCostService.updateCost(mCList);
            moveCosts = this.getTreeOrgs(mCList);
            return R.ok().put("data", moveCosts);
        }
        if (mCList.get(25).getQuantitie().compareTo(baseDataEntity.getGfgh()) == 0
                && mCList.get(26).getQuantitie().compareTo(baseDataEntity.getGhzs()) == 0
                && mCList.get(27).getQuantitie().compareTo(baseDataEntity.getGhzs()) == 0
                && mCList.get(10).getQuantitie().compareTo(baseDataEntity.getZjdjzmjgq()) == 0) {
            moveCosts = this.getTreeOrgs(mCList);
            return R.ok().put("data", moveCosts);
        } else {
            mCList = this.getMCList(mCList, baseDataEntity);
            moveCostService.updateCost(mCList);
            moveCosts = this.getTreeOrgs(mCList);
            return R.ok().put("data", moveCosts);
        }
    }

    */
/*
   * 获取投资计划表
   * *//*

    @RequestMapping("/investment")
    @ResponseBody
    public R investment(@RequestParam("pjid") Integer pjid) throws Exception {
        List<MoveCost> mCList = moveCostService.getCostRTInvest(pjid, 1);
        List<MoveCost> moveCosts;
        BaseDataEntity baseDataEntity = this.queryBaseData(pjid, null);
        //比较数据是否一致  一致返回   不一致重新查询修改
        if (mCList == null || mCList.get(25).getQuantitie() == null || mCList.get(26).getQuantitie() == null
                || mCList.get(27).getQuantitie() == null || mCList.get(10).getQuantitie() == null) {
            mCList = this.getMCList(mCList, baseDataEntity);
            moveCostService.updateCost(mCList);
            moveCosts = this.getTreeOrgs(mCList);
            return R.ok().put("data", moveCosts);
        }
        if (mCList.get(25).getQuantitie().compareTo(baseDataEntity.getGfgh()) == 0
                && mCList.get(26).getQuantitie().compareTo(baseDataEntity.getGhzs()) == 0
                && mCList.get(27).getQuantitie().compareTo(baseDataEntity.getGhzs()) == 0
                && mCList.get(10).getQuantitie().compareTo(baseDataEntity.getZjdjzmjgq()) == 0) {
            moveCosts = this.getTreeOrgs(mCList);
            return R.ok().put("data", moveCosts);
        } else {
            mCList = this.getMCList(mCList, baseDataEntity);
            moveCostService.updateCost(mCList);
            moveCosts = this.getTreeOrgs(mCList);
            return R.ok().put("data", moveCosts);
        }
    }

    */
/*
   * 资金单价修改
   * *//*

    @RequestMapping("/updateMovecost")
    @ResponseBody
    public R updateMovecost(MoveCost moveCost) {
        //查询是否是子级
        MoveCost moveCost1 = moveCostService.getChild(moveCost);
        if (moveCost1 != null) {
            return R.error().put("data", "父级目录不能修改");
        }
        //修改子级
        int i = moveCostService.updateMovecost(moveCost);
        if (i != 0) {
            //修改父级
            moveCostService.updateParent(moveCost);
            //修改总投资,减扣后总投资
            moveCostService.updateZtz(moveCost);
        }
        return R.ok().put("data", null);
    }

    */
/**
     * 修改计费单价
     *
     *  costId 主键
     *  pjid 项目id
     *  bilprice 计费单价
     * @return R
     *//*

    */
/* @RequestMapping("/updateBilprice")
    @ResponseBody
    public R updateBilprice(@RequestParam("costId") Integer costId,
            @RequestParam("pjid") Integer pjid, @RequestParam("bilprice") BigDecimal bilprice) {
        int count = moveCostService.updateBilprice(costId, pjid, bilprice);
        if (count > 0) {
            return R.ok();
        }
        return R.error();
    }*//*


 */
/*
    * 构建树
    * *//*

    public List<MoveCost> getTreeOrgs(List<MoveCost> allOrgs) throws Exception {
        List<MoveCost> listParentRecord = new ArrayList<>();
        List<MoveCost> listNotParentRecord = new ArrayList<>();
        // 第一步：遍历allOrgs找出所有的根节点和非根节点
        if (allOrgs != null && allOrgs.size() > 0) {
            allOrgs.forEach((org) -> {
                if (0 == org.getParentid()) {
                    listParentRecord.add(org);
                } else {
                    listNotParentRecord.add(org);
                }
            });
        }
        // 第二步： 递归获取所有子节点
        if (listParentRecord.size() > 0) {
            for (MoveCost record : listParentRecord) {
                // 添加所有子级
                record.setChildren(this.getChildOrgs(listNotParentRecord, record.getKeyId()));
            }
        }
        return listParentRecord;
    }

    public List<MoveCost> getChildOrgs(List<MoveCost> childList, Integer fatherid) throws Exception {
        List<MoveCost> listParentOrgs = new ArrayList<>();
        List<MoveCost> listNotParentOrgs = new ArrayList<>();
        // 遍历childList，找出所有的根节点和非根节点
        if (childList != null && childList.size() > 0) {
            childList.forEach((record) -> {
                // 对比找出父节点
                if (record.getParentid().equals(fatherid)) {
                    listParentOrgs.add(record);
                } else {
                    listNotParentOrgs.add(record);
                }
            });
        }
        // 查询子节点
        if (listParentOrgs.size() > 0) {
            for (MoveCost record : listParentOrgs) {
                // 递归查询子节点
                record.setChildren(getChildOrgs(listNotParentOrgs, record.getKeyId()));
            }
        }
        return listParentOrgs;
    }

    private List<MoveCost> getMCList1(List<MoveCost> mCList, YlEntity ylEntity) {
        if (ylEntity == null) {
            return null;
        }
        BigDecimal ghZjd = new BigDecimal(200).divide(new BigDecimal(10000));//规划住宅建筑面积
        BigDecimal ghGyl = new BigDecimal(80).divide(new BigDecimal(10000));//规划公寓楼建筑面积
        //BigDecimal ghGf = baseDataEntity.getGfgh().divide(new BigDecimal(10000));//规划公服建筑面积
        Integer zs = 1;//规划宗数
        BigDecimal zjdjzmjgq = ylEntity.getJianzhuArea().divide(new BigDecimal(10000));//宅基地建筑面积万m2
        BigDecimal zjdzdmjm = ylEntity.getArea().divide(new BigDecimal(10000));//宅基地占地面积亩
        BigDecimal bzfts = new BigDecimal(ylEntity.getBzfts());//保障房套数

        BigDecimal sum1 = new BigDecimal(0);
        BigDecimal sum2 = new BigDecimal(0);
        BigDecimal sum3 = new BigDecimal(0);
        //BigDecimal sum9 = new BigDecimal(0);

        //计算正常数值
        for (int i = 0; i < mCList.size(); i++) {
            MoveCost moveCost = mCList.get(i);
            if (moveCost.getCount() != null) {
                //宅基地占地面积亩
                if (zjdzdmjm != null && zjdzdmjm.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("1.1")) {
                        BigDecimal sumcost = (zjdzdmjm.subtract(ghZjd)).multiply(moveCost.getBilprice()).setScale(2, BigDecimal.ROUND_HALF_UP);
                        moveCost.setSumcost(sumcost);
                        moveCost.setQuantitie(zjdzdmjm.subtract(ghZjd));
                        sum1 = sum1.add(sumcost);
                    }
                }
                //宅基地建筑面积
                if (zjdjzmjgq != null && zjdjzmjgq.compareTo(new BigDecimal(0)) > 0) {
                    switch (moveCost.getCount()) {
                        case "1.2": {
                            BigDecimal sumcost = zjdjzmjgq.multiply(moveCost.getBilprice()).setScale(2, BigDecimal.ROUND_HALF_UP);
                            moveCost.setSumcost(sumcost);
                            moveCost.setQuantitie(zjdjzmjgq);
                            sum1 = sum1.add(sumcost);
                            break;
                        }
                        case "1.3": {
                            BigDecimal sumcost = zjdjzmjgq.multiply(moveCost.getBilprice()).setScale(2, BigDecimal.ROUND_HALF_UP);
                            moveCost.setSumcost(sumcost);
                            moveCost.setQuantitie(zjdjzmjgq);
                            sum1 = sum1.add(sumcost);
                            break;
                        }
                        case "1.4":
                        case "1.5": {
                            BigDecimal sumcost;
                            if (moveCost.getCount().equals("1.4")) {
                                /*/
/*12*2
                                sumcost = ghZjd.multiply(moveCost.getBilprice()).multiply(new BigDecimal(12 * 2))
                                        .setScale(2, BigDecimal.ROUND_HALF_UP);
                                moveCost.setQuantitie(ghZjd);
                            } else {
                                sumcost = zjdjzmjgq.multiply(moveCost.getBilprice())
                                        .setScale(2, BigDecimal.ROUND_HALF_UP);
                                moveCost.setQuantitie(zjdjzmjgq);
                            }
                            moveCost.setSumcost(sumcost);
                            sum1 = sum1.add(sumcost);
                            break;
                        }
                        default:
                            break;
                    }
                }
                //宅基地宗数
                if (zs != null && zs > 0) {
                    if (moveCost.getCount().equals("1.6")) {
                        moveCost.setQuantitie(new BigDecimal(zs));
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice()).divide(new BigDecimal(10000));
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum1 = sum1.add(sumcost);
                    }
                }
                //规划-住宅面积
                if (ghZjd != null && ghZjd.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("2")) {
                        moveCost.setQuantitie(ghZjd);
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum2 = sum2.add(sumcost);
                    }
                }

                if (bzfts != null && bzfts.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("3")) {
                        moveCost.setQuantitie(bzfts.multiply(ghGyl));
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum3 = sum3.add(sumcost);
                    }
                }
                mCList.remove(i);
                mCList.add(i, moveCost);
            }

        }
        //计算1 \ 4
        for (int i = 0; i < mCList.size(); i++) {
            MoveCost moveCost = mCList.get(i);
            if (moveCost.getCount() != null) {
                if (moveCost.getCount().equals("1")) {
                    moveCost.setSumcost(sum1.setScale(2, BigDecimal.ROUND_HALF_UP));
                } else if (moveCost.getCount().equals("4")) {
                    BigDecimal sum4 = sum1.subtract(sum2).subtract(sum3);
                    moveCost.setSumcost(sum4.setScale(2, RoundingMode.HALF_UP));
                }
            }
        }
        return mCList;
    }

    private List<MoveCost> getMCList(List<MoveCost> mCList, BaseDataEntity baseDataEntity) {
        if (baseDataEntity == null) {
            return null;
        }
        BigDecimal ghZjd = baseDataEntity.getZjdgh();//规划住宅建筑面积
        BigDecimal ghGyl = baseDataEntity.getGylgh();//规划公寓楼建筑面积
        BigDecimal ghGf = baseDataEntity.getGfgh();//规划公服建筑面积
        BigDecimal gh = baseDataEntity.getGhzs();//规划总数
        Integer zs = baseDataEntity.getZjdzs();//规划宗数
        BigDecimal zjdjzmjgq = baseDataEntity.getZjdjzmjgq();//宅基地建筑面积万m2
        BigDecimal zjdzdmjm = baseDataEntity.getZjdzdmjm();//宅基地占地面积亩

        BigDecimal sum1 = new BigDecimal(0);
        BigDecimal sum2 = new BigDecimal(0);
        BigDecimal sum2_1_8 = new BigDecimal(0);
        BigDecimal sum2_9 = new BigDecimal(0);
        BigDecimal sum3 = new BigDecimal(0);
        BigDecimal sum4 = new BigDecimal(0);
        BigDecimal sum5 = new BigDecimal(0);
        BigDecimal sum6 = new BigDecimal(0);
        BigDecimal sum7 = new BigDecimal(0);
        BigDecimal sum8 = new BigDecimal(0);
        BigDecimal sum9 = new BigDecimal(0);
        BigDecimal sum10;

        //计算正常数值
        for (int i = 0; i < mCList.size(); i++) {
            MoveCost moveCost = mCList.get(i);
            if (moveCost.getCount() != null) {
                //总规划面积
                if (gh != null && gh.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("1.1")
                            || moveCost.getCount().equals("1.2")
                            || moveCost.getCount().equals("1.3")
                            || moveCost.getCount().equals("1.4")
                            || moveCost.getCount().equals("1.5")
                            || moveCost.getCount().equals("1.6")
                            || moveCost.getCount().equals("1.7")) {
                        moveCost.setQuantitie(gh);
                        BigDecimal sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum1 = sum1.add(sumcost);
                    } else if (moveCost.getCount().equals("3.4")
                            || moveCost.getCount().equals("3.5")) {
                        moveCost.setQuantitie(gh);
                        BigDecimal sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum3 = sum3.add(sumcost);
                    }
                }
                //宅基地占地面积亩
                if (zjdzdmjm != null && zjdzdmjm.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("2.1")) {
                        BigDecimal qua = zjdzdmjm.subtract(new BigDecimal(400 * 0.27)).divide(new BigDecimal(15), 3, ROUND_HALF_DOWN);
                        moveCost.setQuantitie(qua.setScale(2, BigDecimal.ROUND_HALF_UP));
                        BigDecimal sumcost = qua.multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum2 = sum2.add(sumcost);
                        sum2_1_8 = sum2_1_8.add(sumcost);
                    }
                }
                //宅基地建筑面积
                if (zjdjzmjgq != null && zjdjzmjgq.compareTo(new BigDecimal(0)) > 0) {
                    switch (moveCost.getCount()) {
                        case "2.2":
                        case "2.3": {
                            moveCost.setQuantitie(zjdjzmjgq);
                            BigDecimal sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                            moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                            sum2 = sum2.add(sumcost);
                            sum2_1_8 = sum2_1_8.add(sumcost);
                            break;
                        }
                        case "2.4":
                        case "2.5": {
                            //建筑面积+4
                            moveCost.setQuantitie(zjdjzmjgq.add(new BigDecimal(4)));
                            BigDecimal sumcost;
                            if (moveCost.getCount().equals("2.4")) {
                                /*/
/*12*2
                                sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie()).multiply(new BigDecimal(12 * 2));
                            } else {
                                sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                            }
                            moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                            sum2 = sum2.add(sumcost);
                            sum2_1_8 = sum2_1_8.add(sumcost);
                            break;
                        }
                        case "2.9.1": {
                            //建筑面积
                            moveCost.setQuantitie(zjdjzmjgq);
                            BigDecimal sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                            moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                            sum2_9 = sum2_9.add(sumcost);
                            break;
                        }
                        case "2.9.4": {
                            //建筑面积*3
                            moveCost.setQuantitie(zjdjzmjgq.multiply(new BigDecimal(3)));
                            BigDecimal sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                            moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                            sum2_9 = sum2_9.add(sumcost);
                            break;
                        }
                        default:
                            break;
                    }
                }
                //宅基地宗数
                if (zs != null && zs > 0) {
                    if (moveCost.getCount().equals("2.6")) {
                        moveCost.setQuantitie(new BigDecimal(zs));
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice()).divide(new BigDecimal(10000));
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum2 = sum2.add(sumcost);
                        sum2_1_8 = sum2_1_8.add(sumcost);
                    }
                }
                //
                if (moveCost.getCount().equals("2.7")
                        || moveCost.getCount().equals("2.8")) {
                    BigDecimal sumcost = new BigDecimal(0);
                    if (moveCost.getQuantitie() != null) {
                        sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                    }
                    moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                    sum2 = sum2.add(sumcost);
                    sum2_1_8 = sum2_1_8.add(sumcost);
                }
                //规划-住宅面积
                if (ghZjd != null && ghZjd.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("3.1")) {
                        moveCost.setQuantitie(ghZjd);
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum3 = sum3.add(sumcost);
                    } else if (moveCost.getCount().equals("8")) {
                        moveCost.setQuantitie(ghZjd);
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum8 = sum8.add(sumcost);
                    }
                }
                //规划-公寓面积
                if (ghGyl != null && ghGyl.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("3.2")) {
                        moveCost.setQuantitie(ghGyl);
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum3 = sum3.add(sumcost);
                    } else if (moveCost.getCount().equals("9")) {
                        moveCost.setQuantitie(ghGyl);
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum9 = sum9.add(sumcost);
                    }
                }
                //规划-公服面积
                if (ghGf != null && ghGf.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("3.3")) {
                        moveCost.setQuantitie(ghGf);
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum3 = sum3.add(sumcost);
                    }
                }
                //2.9.2 \ 2.9.3
                if (ghGf != null && ghGf.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("2.9.2")
                            || moveCost.getCount().equals("2.9.3")) {
                        moveCost.setQuantitie(sum2_1_8);
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum2_9 = sum2_9.add(sumcost);
                    }
                }
                mCList.remove(i);
                mCList.add(i, moveCost);
            }

        }
        //计算1 \ 2 \ 3 \ 4 \ 5 \ 6 \ 7 \ 10
        for (int i = 0; i < mCList.size(); i++) {
            MoveCost moveCost = mCList.get(i);
            if (moveCost.getCount() != null) {
                switch (moveCost.getCount()) {
                    case "1":
                        moveCost.setSumcost(sum1.setScale(2, BigDecimal.ROUND_HALF_UP));
                        break;
                    case "2":
                        sum2 = sum2.add(sum2_9);
                        moveCost.setSumcost(sum2.setScale(2, BigDecimal.ROUND_HALF_UP));
                        break;
                    case "3":
                        moveCost.setSumcost(sum3.setScale(2, BigDecimal.ROUND_HALF_UP));
                        break;
                    case "4":
                    case "5":
                    case "6":
                        BigDecimal sum1_2_3_8_9 = sum1.add(sum2).add(sum3).subtract(sum8).subtract(sum9);
                        moveCost.setQuantitie(sum1_2_3_8_9);
                        BigDecimal sumcost = sum1_2_3_8_9.multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        switch (moveCost.getCount()) {
                            case "4":
                                sum4 = sum4.add(sumcost);
                                break;
                            case "5":
                                sum5 = sum5.add(sumcost);
                                break;
                            case "6":
                                sum6 = sum6.add(sumcost);
                                break;
                            default:
                                break;
                        }
                        break;
                    case "7":
                        BigDecimal sum1_2_3_4_5_6 = sum1.add(sum2).add(sum3).add(sum4).add(sum5).add(sum6);
                        moveCost.setSumcost(sum1_2_3_4_5_6.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum7 = sum1_2_3_4_5_6;
                        break;
                    case "10":
                        sum10 = sum7.subtract(sum8).subtract(sum9);
                        moveCost.setSumcost(sum10.setScale(2, BigDecimal.ROUND_HALF_UP));
                        break;
                    default:
                        break;
                }
            }
        }
        return mCList;
    }

    private List<MoveCost> getMCList2(List<MoveCost> mCList, BaseDataEntity baseDataEntity) {
        if (baseDataEntity == null) {
            return null;
        }
        BigDecimal ghGf = baseDataEntity.getGfgh();//规划公服建筑面积
        Integer zs = baseDataEntity.getZjdzs();//规划宗数
        BigDecimal zjdjzmjgq = baseDataEntity.getZjdjzmjgq();//宅基地建筑面积万m2
        BigDecimal zjdzdmjm = baseDataEntity.getZjdzdmjm();//宅基地占地面积亩

        BigDecimal sum2 = new BigDecimal(0);
        BigDecimal sum2_1_8 = new BigDecimal(0);
        BigDecimal sum2_9 = new BigDecimal(0);

        //计算正常数值
        for (int i = 0; i < mCList.size(); i++) {
            MoveCost moveCost = mCList.get(i);
            if (moveCost.getCount() != null) {
                //宅基地占地面积亩
                if (zjdzdmjm != null && zjdzdmjm.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("1.1")) {
                        BigDecimal qua = zjdzdmjm.subtract(new BigDecimal(400 * 0.27)).divide(new BigDecimal(15), 3, ROUND_HALF_DOWN);
                        moveCost.setQuantitie(qua.setScale(2, BigDecimal.ROUND_HALF_UP));
                        BigDecimal sumcost = qua.multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum2 = sum2.add(sumcost);
                        sum2_1_8 = sum2_1_8.add(sumcost);
                    }
                }

                //宅基地建筑面积
                if (zjdjzmjgq != null && zjdjzmjgq.compareTo(new BigDecimal(0)) > 0) {
                    switch (moveCost.getCount()) {
                        case "1.2":
                        case "1.3": {
                            moveCost.setQuantitie(zjdjzmjgq);
                            BigDecimal sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                            moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                            sum2 = sum2.add(sumcost);
                            sum2_1_8 = sum2_1_8.add(sumcost);
                            break;
                        }
                        case "1.4":
                        case "1.5": {
                            //建筑面积+4
                            moveCost.setQuantitie(zjdjzmjgq.add(new BigDecimal(4)));
                            BigDecimal sumcost;
                            if (moveCost.getCount().equals("1.4")) {
                                /*/
/*12*2
                                sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie()).multiply(new BigDecimal(12 * 2));
                            } else {
                                sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                            }
                            moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                            sum2 = sum2.add(sumcost);
                            sum2_1_8 = sum2_1_8.add(sumcost);
                            break;
                        }
                        case "1.9.1": {
                            //建筑面积
                            moveCost.setQuantitie(zjdjzmjgq);
                            BigDecimal sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                            moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                            sum2_9 = sum2_9.add(sumcost);
                            break;
                        }
                        case "1.9.4": {
                            //建筑面积*3
                            moveCost.setQuantitie(zjdjzmjgq.multiply(new BigDecimal(3)));
                            BigDecimal sumcost = moveCost.getBilprice().multiply(moveCost.getQuantitie());
                            moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                            sum2_9 = sum2_9.add(sumcost);
                            break;
                        }
                        default:
                            break;
                    }
                }

                //宅基地宗数
                if (zs != null && zs > 0) {
                    if (moveCost.getCount().equals("1.6")) {
                        moveCost.setQuantitie(new BigDecimal(zs));
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice()).divide(new BigDecimal(10000));
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum2 = sum2.add(sumcost);
                        sum2_1_8 = sum2_1_8.add(sumcost);
                    }
                }
                if (moveCost.getCount().equals("1.7")
                        || moveCost.getCount().equals("1.8")) {
                    BigDecimal sumcost = new BigDecimal(0);
                    if (moveCost.getQuantitie() != null) {
                        sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                    }
                    moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                    sum2 = sum2.add(sumcost);
                    sum2_1_8 = sum2_1_8.add(sumcost);
                }

                //2.9.2 \ 2.9.3
                if (ghGf != null && ghGf.compareTo(new BigDecimal(0)) > 0) {
                    if (moveCost.getCount().equals("1.9.2")
                            || moveCost.getCount().equals("1.9.3")) {
                        moveCost.setQuantitie(sum2_1_8);
                        BigDecimal sumcost = moveCost.getQuantitie().multiply(moveCost.getBilprice());
                        moveCost.setSumcost(sumcost.setScale(2, BigDecimal.ROUND_HALF_UP));
                        sum2_9 = sum2_9.add(sumcost);
                    }
                }
                mCList.remove(i);
                mCList.add(i, moveCost);
            }
        }
        //计算
        for (int i = 0; i < mCList.size(); i++) {
            MoveCost moveCost = mCList.get(i);
            if (moveCost.getCount().equals("1.9")) {
                moveCost.setSumcost(sum2_9);
            }
            if (moveCost.getCount() != null && moveCost.getCount().equals("1")) {
                sum2 = sum2.add(sum2_9);
                moveCost.setSumcost(sum2.setScale(2, BigDecimal.ROUND_HALF_UP));
            }
        }
        return mCList;
    }

}
*/
